import java.util.Scanner;

public class a058_MOD3 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int m;
		int n;
		
		int mod3_0, mod3_1, mod3_2;
		
		while(sc.hasNext()) {
			m = sc.nextInt();
			
			mod3_0 = mod3_1 = mod3_2 = 0;			
			for(int i = 0; i < m; i++) {
				sc.nextLine();
				
				n = sc.nextInt();
				
				if(n % 3 == 0)
					mod3_0 ++;
				else if(n % 3 == 1)
					mod3_1 ++;
				else if(n % 3 == 2)
					mod3_2 ++;
			}
			
			System.out.println(Integer.toString(mod3_0) + " " + Integer.toString(mod3_1) + " " + Integer.toString(mod3_2));
		}
	}
	
}